home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsISafeOutputStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  4KB  |  117 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsISafeOutputStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsISafeOutputStream_h__
  6. #define __gen_nsISafeOutputStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17.  
  18. /* starting interface:    nsISafeOutputStream */
  19. #define NS_ISAFEOUTPUTSTREAM_IID_STR "5f914307-5c34-4e1f-8e32-ec749d25b27a"
  20.  
  21. #define NS_ISAFEOUTPUTSTREAM_IID \
  22.   {0x5f914307, 0x5c34, 0x4e1f, \
  23.     { 0x8e, 0x32, 0xec, 0x74, 0x9d, 0x25, 0xb2, 0x7a }}
  24.  
  25. /**
  26.  * This interface provides a mechanism to control an output stream
  27.  * that takes care not to overwrite an existing target until it is known
  28.  * that all writes to the destination succeeded.
  29.  * 
  30.  * An object that supports this interface is intended to also support
  31.  * nsIOutputStream.
  32.  *
  33.  * For example, a file output stream that supports this interface writes to
  34.  * a temporary file, and moves it over the original file when |finish| is
  35.  * called only if the stream can be successfully closed and all writes
  36.  * succeeded.  If |finish| is called but something went wrong during
  37.  * writing, it will delete the temporary file and not touch the original.
  38.  * If the stream is closed by calling |close| directly, or the stream
  39.  * goes away, the original file will not be overwritten, and the temporary
  40.  * file will be deleted.
  41.  *
  42.  * Currently, this interface is implemented only for file output streams.
  43.  */
  44. class NS_NO_VTABLE nsISafeOutputStream : public nsISupports {
  45.  public: 
  46.  
  47.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISAFEOUTPUTSTREAM_IID)
  48.  
  49.   /**
  50.      * Call this method to close the stream and cause the original target
  51.      * to be overwritten. Note: if any call to |write| failed to write out
  52.      * all of the data given to it, then calling this method will |close| the
  53.      * stream and return failure. Further, if closing the stream fails, this
  54.      * method will return failure. The original target will be overwritten only
  55.      * if all calls to |write| succeeded and the stream was successfully closed.
  56.      */
  57.   /* void finish (); */
  58.   NS_IMETHOD Finish(void) = 0;
  59.  
  60. };
  61.  
  62. /* Use this macro when declaring classes that implement this interface. */
  63. #define NS_DECL_NSISAFEOUTPUTSTREAM \
  64.   NS_IMETHOD Finish(void); 
  65.  
  66. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  67. #define NS_FORWARD_NSISAFEOUTPUTSTREAM(_to) \
  68.   NS_IMETHOD Finish(void) { return _to Finish(); } 
  69.  
  70. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  71. #define NS_FORWARD_SAFE_NSISAFEOUTPUTSTREAM(_to) \
  72.   NS_IMETHOD Finish(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Finish(); } 
  73.  
  74. #if 0
  75. /* Use the code below as a template for the implementation class for this interface. */
  76.  
  77. /* Header file */
  78. class nsSafeOutputStream : public nsISafeOutputStream
  79. {
  80. public:
  81.   NS_DECL_ISUPPORTS
  82.   NS_DECL_NSISAFEOUTPUTSTREAM
  83.  
  84.   nsSafeOutputStream();
  85.  
  86. private:
  87.   ~nsSafeOutputStream();
  88.  
  89. protected:
  90.   /* additional members */
  91. };
  92.  
  93. /* Implementation file */
  94. NS_IMPL_ISUPPORTS1(nsSafeOutputStream, nsISafeOutputStream)
  95.  
  96. nsSafeOutputStream::nsSafeOutputStream()
  97. {
  98.   /* member initializers and constructor code */
  99. }
  100.  
  101. nsSafeOutputStream::~nsSafeOutputStream()
  102. {
  103.   /* destructor code */
  104. }
  105.  
  106. /* void finish (); */
  107. NS_IMETHODIMP nsSafeOutputStream::Finish()
  108. {
  109.     return NS_ERROR_NOT_IMPLEMENTED;
  110. }
  111.  
  112. /* End of implementation class template. */
  113. #endif
  114.  
  115.  
  116. #endif /* __gen_nsISafeOutputStream_h__ */
  117.